package com.example.demo.service.impl;

import com.example.demo.entity.News;
import com.example.demo.mapper.NewsMapper;
import com.example.demo.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

// 新闻服务实现类
@Service
public class NewsServiceImpl implements NewsService {
    @Autowired
    private NewsMapper newsMapper;

    @Override
    public List<News> getAllNews() {
        return newsMapper.getAllNews();
    }

    @Override
    public News getNewsById(Long id) {
        return newsMapper.getNewsById(id);
    }

    @Override
    public void insertNews(News news) {
        newsMapper.insertNews(news);
    }

    @Override
    public void deleteNews(Long id) {
        newsMapper.deleteNews(id);
    }
}
